<?php /* Smarty version Smarty-3.1.13, created on 2013-12-31 10:27:03
         compiled from "G:\phpserver\ibo123\templates\usermanage.tpl" */ ?>
<?php /*%%SmartyHeaderCode:856652c22b7750bfb4-20831827%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'bf2308463255f433993d127c1f7385d1a511d9a3' => 
    array (
      0 => 'G:\\phpserver\\ibo123\\templates\\usermanage.tpl',
      1 => 1388418844,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '856652c22b7750bfb4-20831827',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'user' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.13',
  'unifunc' => 'content_52c22b776548a1_77608202',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_52c22b776548a1_77608202')) {function content_52c22b776548a1_77608202($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("layouts/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>


<script type="text/javascript"
	src="<?php echo @constant('WEBSITE_URL');?>
public/assets/lib/ajaxupload.js"></script>

<script type="text/javascript">
  var weburl = '<?php echo @constant('WEBSITE_URL');?>
';
  getUsermassage();


	//文件上传组件处理
	jQuery(function () {
		 	var button = jQuery('#selectfile');//绑定事件
		var load = new AjaxUpload(button, {//绑定AjaxUpload
	    action: "<?php echo @constant('WEBSITE_URL');?>
admin/fileupload/fileup",//文件要上传到的处理页面,语言可以PHP,ASP,JSP等
	    type:"POST",//提交方式
	    data:{//还可以提交的值
	        module:"ajaxupload",
	        type:jQuery("#__mstype__").attr("value"),
	    },
	    autoSubmit:true,//选择文件后,是否自动提交.这里可以变成true,自己去看看效果吧.
	    name:'msUploadFile',//提交的名字
	    onChange:function(file,ext){//当选择文件后执行的方法,ext存在文件后续,可以在这里判断文件格式
// 			$("#user_photo").attr("value",file);
	    },
	    onSubmit: function (file, ext) {//提交文件时执行的方法
	    	if(ext && /^(jpg|jpeg|png|gif)$/.test(ext)){
				//ext是后缀名
	    		button.value = "正在上传…";
	    		button.disabled = "disabled";
			}else{	
				alert("不支持的文件格式！只能上传jpg|jpeg|png|gif") ;
				return false;
			}
	    },
	    onComplete: function (file, response) {//文件提交完成后可执行的方法
	        button.text('浏览');
	        this.enable();
			var data=eval("("+response+")");
			if(data.type==0){
				alert(data.message);
			}else{
				$('#user_photo').val(data.filename);
				$("#user_img").attr("src","<?php echo @constant('WEBSITE_URL');?>
upload/"+data.filename);
	        	
			}
	    }
	});
	});
	
  
function getUsermassage(){
	$.ajax({
        type: "POST",
        url: weburl+'usermanage/getMsg',
        success:function(data){
        	var udata =   JSON.parse(data);
        	console.log(udata,'%');
        	$("#userid").val(udata.userid);
        	$("#username").val(udata.username);
        	$("#firstname").val(udata.firstname);
        	$("#lastname").val(udata.lastname);
        	$("#email").val(udata.email);
        	$("#user_photo").val(udata.user_photo);
        	$("#password").val(udata.password);

        	$("#user_img").attr("src","<?php echo @constant('WEBSITE_URL');?>
upload/"+udata.user_photo);
        	
	    },
        error: function () {
        }
    });
}
function modify(){
	$.ajax({
		type:"post",
        url: weburl+'usermanage/modify',
        data:$('#loadform').serialize(),
        success:function(data){
            if(data >0){
                alert("修改成功!");
            }
	    },
        error: function () {
        }
    });
}

function changePhoto(){
	
}
</script>

<div class="container-fluid">
	<div class="row-fluid">
		<table style="width: 800; height: 400px">
			<tr>
				<td>
					<form id="loadform" method="post" class="form-horizontal"
						style="width: 200px">
						<input type="text" id="user_photo" name="user_photo"
								  hidden="true" />
						<div class="control-group" hidden="true">
							<input type="text" id="userid" name="userid"
								value="<?php echo $_smarty_tpl->tpl_vars['user']->value['userid'];?>
" hidden="true" />
						</div>
						<div class="control-group">
							<label class="control-label" for="Text input">用户名:</label>
							<div class="controls">
								<input id="username" placeholder="用户名" name="username"> </input>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="Text input">姓:</label>
							<div class="controls">
								<input id="firstname" placeholder="姓" name="firstname"> </input>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="Text input">名:</label>
							<div class="controls">
								<input id="lastname" placeholder="名字" name="lastname"> </input>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="Text input">邮箱:</label>
							<div class="controls">
								<input id="email" placeholder="邮箱" name="email"> </input>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" for="Text input">密码</label>
							<div class="controls">
								<input id="password" type="password" placeholder="密码"
									name="password"> </input>
							</div>
						</div>

						<div class="control-group">
							<button type="button" class="btn btn-primary" onclick="modify()">修改</button>
						</div>
					</form>
				</td>
				<td><img id="user_img" alt=""
					src="<?php echo @constant('WEBSITE_URL');?>
public/photo/3.jpg" width="100"
					height="100" /> <input type="button" class="btn btn-small"
					id="selectfile" value="图片选择" /></td>
			</tr>
		</table>
	</div>
</div>
<?php echo $_smarty_tpl->getSubTemplate ("layouts/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<?php }} ?>